package entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;


@Entity
@Table(name="T_DELIVERER_ORDER_DETAILS")
public class DelivererOrderDetails implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private int delivererOrderDetailId;
	private DelivererOrder delivererOrder;
	private Product product;
	private int amount;

	public DelivererOrderDetails() {
	}

	public DelivererOrderDetails(DelivererOrder delivererOrder, Product product, int amount) {
		this.delivererOrder = delivererOrder;
		this.product = product;
		this.amount = amount;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name="DELIVERER_ORDER_DETAILS_ID",unique = true, nullable = false)
	public int getDelivererOrderDetailId() {
		return delivererOrderDetailId;
	}

	public void setDelivererOrderDetailId(int delivererOrderDetailId) {
		this.delivererOrderDetailId = delivererOrderDetailId;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "DELIVERER_ORDER_ID", nullable = false)
	public DelivererOrder getDelivererOrder() {
		return delivererOrder;
	}

	public void setDelivererOrder(DelivererOrder delivererOrder) {
		this.delivererOrder = delivererOrder;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "PRODUCT_ID", nullable = false)
	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}
	
	@Column(name="AMOUNT", nullable=false)
	public int getAmount() {
		return amount;
	}

	public void setAmount(int amount) {
		this.amount = amount;
	}
	
	
}
